# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=date
pkgver=3.0.3
pkgrel=0
pkgdesc="Date and time library based on the C++11/14/17 <chrono> header"
arch="all"
url="https://howardhinnant.github.io/date/date.html"
license="MIT"
makedepends="cmake samurai"
checkdepends="bash"
source="https://github.com/HowardHinnant/date/archive/v$pkgver/date-v$pkgver.tar.gz
	538-output-date-pc-for-pkg-config.patch
	"
subpackages="$pkgname-dev"
options="!check" # Several tests fail - see also https://github.com/HowardHinnant/date/issues/334

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=true \
		-DBUILD_TZ_LIB=true \
		-DUSE_SYSTEM_TZ_DB=true \
		-DENABLE_DATE_TESTING=true \
		-Wno-dev
	cmake --build build
}

check() {
	cmake --build build --target testit
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="
e11d7f230ecc431d94c4b58fe7394dd57a9ec0baa9de52496578479b51bbf885566d6666882916d84d388060fa36065b3fa8dd3a8bc14f720b38d1c943f06700  date-v3.0.3.tar.gz
c92e9bc76554859687b0d1a7b0e09ab1044cc46a208e57ea112fcc87d5ed1e8fd21b195079dacbc17adf7830dd4e0b10deb67859263c26822f57225316c27e10  538-output-date-pc-for-pkg-config.patch
"
